//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<default.fxh>
///	@path	~/xeres.engine/res/fx/
///	@date	2008/09/25
///	@desc	Provide default materials.

#include "standard_fx.fxh"

#ifdef D3D10
#define PS_OUTPUT		SV_Target
#else
#define PS_OUTPUT		COLOR
#endif

// Vertex shaders.

// Pass through vertex shader.
float4 VSPassThroughPos( float3 Position : POSITION ) : POSITION
{
	return TransformPosition3( Position );
}

// Pass through vertex shader.
float4 VSPassThroughPosT( float4 Position : POSITIONT ) : POSITIONT
{
	return Position;
}

struct VSOutputPositionColor
{
	float4 Position : POSITION;
	float4 Diffuse : COLOR;
};

// Pass through with position & color.
VSOutputPositionColor VSPassThroughPosAndColor( float3 Position : POSITION , float4 Color: COLOR )
{
	VSOutputPositionColor output;
	output.Position = TransformPosition3( Position );
	output.Diffuse = Color;
	return output;
}

struct VSOutputPositionTColor
{
	float4 Position : POSITION;
	float4 Diffuse : COLOR;
};

// Pass through with position & color.
VSOutputPositionTColor VSPassThroughPosTAndColor( float4 Position : POSITIONT , float4 Color: COLOR )
{
	VSOutputPositionColor output;
	output.Position = Position;
	output.Diffuse = Color;
	return output;
}

// Pixel shaders.

// Pass through pixel shader.
float4 PSPassThroughPos( float4 Position : POSITION ) : PS_OUTPUT
{
	return float4(1,1,1,1);
}

// Pass through pixel shader.
float4 PSPassThroughPosT( float4 Position : HPOSITION ) : PS_OUTPUT
{
	return float4(1,1,1,1);
}

// Pass through with position & color.
float4 PSPassThroughPosAndColor( VSOutputPositionColor input ) : PS_OUTPUT
{
	return input.Diffuse;
}

// Pass through with position & color.
float4 PSPassThroughPosTAndColor( VSOutputPositionTColor input ) : PS_OUTPUT
{
	return input.Diffuse;
}

#ifdef D3D10

technique10 PassThroughPos {
	pass p0 {
		// states
		SetBlendState( RegularBlending , float4(1,1,1,1) , 0xffffffff );
		// shader
		SetVertexShader( CompileShader( vs_4_0 , VSPassThroughPos() ) );
		SetGeometryShader( NULL );
		SetPixelShader( CompileShader( ps_4_0 , PSPassThroughPos() ) );
	}
}

technique10 PassThroughPosT {
	pass p0 {
		// states
		SetBlendState( RegularBlending , float4(1,1,1,1) , 0xffffffff );
		// shader
		SetVertexShader( CompileShader( vs_4_0 , VSPassThroughPosT() ) );
		SetGeometryShader( NULL );
		SetPixelShader( CompileShader( ps_4_0 , PSPassThroughPosT() ) );
	}
}

technique10 PassThroughPosAndColor {
	pass p0 {
		// states
		SetBlendState( RegularBlending , float4(1,1,1,1) , 0xffffffff );
		// shader
		SetVertexShader( CompileShader( vs_4_0 , VSPassThroughPosAndColor() ) );
		SetGeometryShader( NULL );
		SetPixelShader( CompileShader( ps_4_0 , PSPassThroughPosAndColor() ) );
	}
}

technique10 PassThroughPosTAndColor {
	pass p0 {
		// states
		SetBlendState( RegularBlending , float4(1,1,1,1) , 0xffffffff );
		// shader
		SetVertexShader( CompileShader( vs_4_0 , VSPassThroughPosTAndColor() ) );
		SetGeometryShader( NULL );
		SetPixelShader( CompileShader( ps_4_0 , PSPassThroughPosTAndColor() ) );
	}
}

#else

technique PassThroughPos {
	pass p0 {
		VertexShader = compile vs_2_0 VSPassThroughPos();
		PixelShader = compile ps_2_0 PSPassThroughPos();
	}
}

technique PassThroughPosT {
	pass p0 {
		VertexShader = compile vs_2_0 VSPassThroughPosT();
		PixelShader = compile ps_2_0 PSPassThroughPosT();
	}
}

technique PassThroughPosAndColor {
	pass p0 {
		VertexShader = compile vs_2_0 VSPassThroughPosAndColor();
		PixelShader = compile ps_2_0 PSPassThroughPosAndColor();
	}
}

technique PassThroughPosTAndColor {
	pass p0 {
		VertexShader = compile vs_2_0 VSPassThroughPosTAndColor();
		PixelShader = compile ps_2_0 PSPassThroughPosTAndColor();
	}
}

#endif
